package com.zzxx.mapper;

import com.zzxx.entity.Gym;
import com.zzxx.entity.GymExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface GymMapper extends GymMapperEx{
    @SelectProvider(type=GymSqlProvider.class, method="countByExample")
    long countByExample(GymExample example);

    @DeleteProvider(type=GymSqlProvider.class, method="deleteByExample")
    int deleteByExample(GymExample example);

    @Delete({
        "delete from gym",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into gym (id, name, ",
        "introduce, itemDesc, ",
        "note, principalID, ",
        "address, src, status)",
        "values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
        "#{introduce,jdbcType=VARCHAR}, #{itemdesc,jdbcType=VARCHAR}, ",
        "#{note,jdbcType=VARCHAR}, #{principalid,jdbcType=VARCHAR}, ",
        "#{address,jdbcType=VARCHAR}, #{src,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER})"
    })
    int insert(Gym row);

    @InsertProvider(type=GymSqlProvider.class, method="insertSelective")
    int insertSelective(Gym row);

    @SelectProvider(type=GymSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="itemDesc", property="itemdesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="note", property="note", jdbcType=JdbcType.VARCHAR),
        @Result(column="principalID", property="principalid", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    List<Gym> selectByExample(GymExample example);

    @Select({
        "select",
        "id, name, introduce, itemDesc, note, principalID, address, src, status",
        "from gym",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="itemDesc", property="itemdesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="note", property="note", jdbcType=JdbcType.VARCHAR),
        @Result(column="principalID", property="principalid", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    Gym selectByPrimaryKey(String id);

    @UpdateProvider(type=GymSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") Gym row, @Param("example") GymExample example);

    @UpdateProvider(type=GymSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") Gym row, @Param("example") GymExample example);

    @UpdateProvider(type=GymSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Gym row);

    @Update({
        "update gym",
        "set name = #{name,jdbcType=VARCHAR},",
          "introduce = #{introduce,jdbcType=VARCHAR},",
          "itemDesc = #{itemdesc,jdbcType=VARCHAR},",
          "note = #{note,jdbcType=VARCHAR},",
          "principalID = #{principalid,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "src = #{src,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(Gym row);
}